<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/10/22
 * Time: 16:05
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\model\mysql;

use app\common\lib\Status;

class Auth extends Base
{
    /**
     * @param string $openid
     * @param string $field
     * @return Auth|array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getAuthByOpenid(string $openid = '', string $field = '*')
    {
        return $this->field($field)->where('openid', $openid)
            ->find();
    }

    public function getSetSexAttr($value)
    {
        if ($value == 0) {
            return "女";
        } else if ($value == 1) {
            return "男";
        } else {
            return "保密";
        }
    }
    public function getStudentTimeAttr($value){
        return date('Y-m',$value);
    }
}